package messages;

import java.util.List;
import java.util.StringTokenizer;

import others.Constants;

public class ErrorMessage extends Message {
    
    public String errorType;

    public ErrorMessage(String error) {
        super(error);
        if(error.equals("401")) {
            errorType = "";
        }
        else if(error.equals("404")) {
            errorType = "not found";
        }
        else if(error.equals("603")) {
            errorType = "decline";
        }
    }

    @Override
    public void parseMessage(List<StringTokenizer> tokens) {
        errorType=tokens.get(0).nextToken();
            //log
            System.out.println(messageType + " " + errorType);
    }

    @Override
    public String writeMessage() {
        return (messageType + " " + errorType + Constants.CRLF);
    }

}
